package com.itestor.iptv.modules.common.vo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;

import com.itestor.iptv.modules.common.domain.UserRoleGroup;

/**
 * 
 * @author Mr.li
 *
 */
public class User implements HttpSessionBindingListener {

    private int id;
    private String username;
    private String password;
    private String realname;
    private String rolename;
    private String phone;
    private String mobile;
    private String email;
    private String description;
    private Date lastUpdateTs;
    private String lastUpdateBy;    
    private static Integer num = 0;

    private Collection<String> rolenames = new ArrayList<String>();
    private String customer;
    private Collection<String> accountnames = new ArrayList<String>();;
    private Map<Integer, Collection<Integer>> devices = new LinkedHashMap<Integer, Collection<Integer>>();
    private Map<Integer, Collection<Integer>> monitorflows = new LinkedHashMap<Integer, Collection<Integer>>();

    private UserRoleGroup userRoleGroup;
    
    public String getCustomer() {
        return customer;
    }

    public void setCustomer(String customer) {
        this.customer = customer;
    }

    public Collection<String> getAccountnames() {
        return accountnames;
    }

    public void setAccountnames(Collection<String> accountnames) {
        this.accountnames = accountnames;
    }

    public Map<Integer, Collection<Integer>> getDevices() {
        return devices;
    }

    public void setDevices(Map<Integer, Collection<Integer>> devices) {
        this.devices = devices;
    }

    public Map<Integer, Collection<Integer>> getMonitorflows() {
        return monitorflows;
    }

    public void setMonitorflows(Map<Integer, Collection<Integer>> monitorflows) {
        this.monitorflows = monitorflows;
    }

    public Collection<String> getRolenames() {
        return rolenames;
    }

    public void setRolenames(Collection<String> rolenames) {
        this.rolenames = rolenames;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    
    
    public UserRoleGroup getUserRoleGroup() {
        return userRoleGroup;
    }

    public void setUserRoleGroup(UserRoleGroup pUserRoleGroup) {
        userRoleGroup = pUserRoleGroup;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getLastUpdateTs() {
        return lastUpdateTs;
    }

    public void setLastUpdateTs(Date lastUpdateTs) {
        this.lastUpdateTs = lastUpdateTs;
    }

    public String getLastUpdateBy() {
        return lastUpdateBy;
    }

    public void setLastUpdateBy(String lastUpdateBy) {
        this.lastUpdateBy = lastUpdateBy;
    }

    private String department;

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getRolename() {
        return rolename;
    }

    public void setRolename(String pRolename) {
        rolename = pRolename;
    }

  
    public void valueBound(HttpSessionBindingEvent pArg0) {
        synchronized (User.class) {
            num++;
        }
    }

    public void valueUnbound(HttpSessionBindingEvent pArg0) {
        synchronized (User.class) {
            num--;
        }
    }

    public static Integer getNum() {
        return num;
    }

    public static void setNum(Integer pNum) {
        num = pNum;
    }

}
